const EventEmitter = require('events');

class CustomEvent extends EventEmitter{}

function fn1(){
	console.log('this is fn1')
}


function fn2(){
	console.log('this is fn2')
}

const ce =new CustomEvent()
ce.on('test',fn1);
ce.on('test',fn2);


console.log(ce.listeners('test'));

setInterval(()=>{
	ce.emit('test')
},500)

setTimeout(()=>{
	// ce.removeListener('test',fn2);
	// ce.removeListener('test',fn1);
	ce.removeAllListeners('test')
},2000)